package com.itsci.assignment2;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class AddGuide extends Activity{
	private EditText name;
	private EditText tel;
	private EditText email;
	private GuideManager guideMgr;
	private Button bnt;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.add_guide);
		name = (EditText)findViewById(R.id.editText_addGuide_name);
		tel = (EditText)findViewById(R.id.editText_addGuide_tel);
		email = (EditText)findViewById(R.id.editText_addGuide_email);
		guideMgr = new GuideManager(AddGuide.this, null,null,1);
		bnt = (Button)findViewById(R.id.button_addGuide_save);
		bnt.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				GuideBean  guideBean = new GuideBean(name.getText().toString(),tel.getText().toString(),email.getText().toString());
				guideMgr.insertGuide(guideBean);
				Intent gotoListGuide = new Intent(AddGuide.this,ListGuide.class);
				startActivity(gotoListGuide);
			}
		});
		
	}
}
